package thorsten.tools;

import java.lang.reflect.Method;

public class SeriesProfiler {

	
	public Object subject;
	public String testedMethod;
	// parameters
	
	
	
	public void run() throws NoSuchMethodException, SecurityException{
		Class testedClass = this.subject.getClass();
		System.out.println(testedClass);
	
		//Method methlist[] = testedClass.getDeclaredMethods();
//		Method methlist[] = testedClass.getMethods();
//		System.out.println(methlist.length);
		Method testedMethod = null;
//		for(Method curMethod : methlist){
//			if(curMethod.getName().equals(this.testedMethod)){
//				testedMethod = curMethod;
//			}
//			
//		}
		
		testedMethod = testedClass.getDeclaredMethod(this.testedMethod, String.class);
		System.out.println(testedMethod);
//		testedMethod.invoke(obj, args)
		
		// Parameter:
		Class pvec[] = testedMethod.getParameterTypes();
		System.out.println(pvec);
		System.out.println(pvec[0]);
		
		
	}
	
	
	/**
	 * @param args
	 * @throws SecurityException 
	 * @throws NoSuchMethodException 
	 */
	public static void main(String[] args) throws NoSuchMethodException, SecurityException {
		// TODO Auto-generated method stub
		
		SeriesProfiler profiler = new SeriesProfiler();
		profiler.subject = new TestedClass();
		profiler.testedMethod="method2";
		
		profiler.run();

		System.out.println("fertig");
	}

}
